package cn.xcstudenth.myapplication.texviewutils;

import android.content.res.Resources;
import android.util.DisplayMetrics;

import cn.xcstudenth.myapplication.AppComplication;

/**
 * Created by 赵航 on 2020/8/13.
 * WeChat: zhao--hang--
 */
public class PhoneCheckUtils {
    /**
     * 获取手机屏幕宽度
     */
    public static int getScreamWidth() {

        Resources      resources = AppComplication.mContext.getResources();
        DisplayMetrics dm        = resources.getDisplayMetrics();
        int            width3    = dm.widthPixels;
        return width3;
    }
    /**
     *
     * @param dpValue 将dp转化为px
     * @return px数值
     */
    public static int changeDpToPx(float dpValue){
        float scale = AppComplication.mContext.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

}
